package com.example.explainus;

import java.util.Map;

import com.example.units.GlobalParameters;
import com.example.units.GlobalVariables;
import com.example.units.Team;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class GameResultsActivity extends Activity 
{

	private TextView tTeam1;
	private TextView tTeam2;
	private TextView tTeam3;
	private TextView tTeam4;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_gameresults);
		tTeam1 = (TextView)findViewById(R.id.tTeam1);
		tTeam2 = (TextView)findViewById(R.id.tTeam2);
		tTeam3 = (TextView)findViewById(R.id.tTeam3);
		tTeam4 = (TextView)findViewById(R.id.tTeam4);
		GlobalParameters.overrideFonts(this, tTeam1);
		GlobalParameters.overrideFonts(this, tTeam2);
		GlobalParameters.overrideFonts(this, tTeam3);
		GlobalParameters.overrideFonts(this, tTeam4);
		
		Map<Integer, Team> teams = GlobalVariables.info.getTeams().getAllTeams();
		if (teams.containsKey(0)) 
		{
			tTeam1.setText(getResources().getString(R.string.tresultsteams) + " 1- " + String.valueOf(teams.get(0).getScore()));
		}
		if (teams.containsKey(1)) 
		{
			tTeam2.setText(getResources().getString(R.string.tresultsteams) + " 2- " + String.valueOf(teams.get(1).getScore()));
		}
		if (teams.containsKey(2)) 
		{
			tTeam3.setText(getResources().getString(R.string.tresultsteams) + " 3- " + String.valueOf(teams.get(2).getScore()));
		}
		if (teams.containsKey(3)) 
		{
			tTeam4.setText(getResources().getString(R.string.tresultsteams) + " 4- " + String.valueOf(teams.get(3).getScore()));
		}
	
	}
	
	public void goExit(View v)
	{
		Intent start = new Intent(GameResultsActivity.this, NewGameActivity.class);
		startActivity(start);
		finish();
	}
	
}
